package com.ding.clientserver.pojo

import org.json.JSONObject

class Token {

    static Token of(JSONObject json){
        def token = new Token()

        token.value=json.getString('access_token')
        token.token_type=json.getString('token_type')
        token.expires=json.getLong('expires_in')
        token.scope=json.getString('scope')
        token.refreshToken=json.getString('refresh_token')
        token
    }

    String value
    String token_type
    String refreshToken
    long expires
    String scope
    String authorization

    void refresh(JSONObject json)
    {
        value=json.getString('access_token')
        token_type=json.getString('token_type')
        expires=json.getLong('expires_in')
        refreshToken=json.getString('refresh_token')
        scope=json.getString('scope')
    }
}
